#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>
#include<ctype.h>
char* my_strcpy(char* dest, const char* s)
{
	char* ret = dest;
	while ((*dest++ = *s++))
	{
		;
	}
	return ret;
}

char* my_strcat(char* dest, const char* s)
{
	char* ret = dest;
	assert(dest != NULL);
	assert(s != NULL);
	while (*dest)
	{
		dest++;
	}
	while (*dest++ = *s++)
	{
		;
	}
	return ret;
}

int my_strcmp(const char* dest, const char* src)
{
	assert(dest);
	assert(src);
	while (*dest == *src)
	{
		if (*dest == '\0')
		{
			return 0;
		}
		dest++;
		src++;
	}
	return *dest - *src;
}
char* my_strstr(const char* p1, const char* p2)
{
	assert(p1 && p2);
	char* cur = (char *)p1;
	char* s1, *s2;
	if (!*p2)
	{
		return ((char*)p1);
	}

	
	while (*cur)
	{
		s1 = cur;
		s2 = (char*)p2;
		while (*s1 == *s2 && *s1 && *s2)
		{
			s1++;
			s2++;
		}
		if (!*s2)
		{
			return (cur);
		}
		cur++;
	}
	return (NULL);

}
char* my_strncpy(char*dest,char*src,int count)
{
	int i = 0;
	assert(dest && src);
	for(i = 0;src != '\0' && i<count;i++)
	{
		dest[i] = src[i];
	}
	dest[i] = '\0';
	return dest;
}

int main()
{
	char arr1[30] = { 0 };
	char arr2[] = "abcdefghig";
	char* pch = my_strstr(arr2, "h");
	printf("%s", pch);
	return 0;
}
 #include <stdio.h>
 #include <string.h>

 int main()
 {
	 char arr[] = "192.168.6.111";
	char* sep = ".";
	 char* str = NULL;
	 for (str = strtok(arr, sep); str != NULL; str = strtok(NULL, sep))
		 {
		 printf("%s\n", str);
		 }
	 return 0;
	 }